<template>
  <div>
    <!-- 合伙人晋升规则 -->
    <el-card>
      <div class="top">
        <el-form :inline="true" :model="query" class="query-form" size="small">
          <el-form-item label="合伙人晋升规则：">
            <el-button
              type="primary"
              icon="el-icon-edit"
              @click.native="showDialogAddOrEdit()"
              >添加
            </el-button>
          </el-form-item>
        </el-form>

        <!--列表start --->
        <el-table
          ref="multipleTable"
          v-loading="loading"
          :data="list"
          :header-cell-style="{ background: '#F4F4F5', color: '#606266' }"
          border
        >
          <!-- <el-table-column type="selection"
                             width="40"
                             fixed /> -->
          <el-table-column
            label="序号"
            prop="globabrandid"
            width="50"
            align="center"
            fixed
          >
            <template slot-scope="scope">
              <span>{{ scope.$index + 1 }}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="平台高级合伙人达标标准"
            width="200"
            align="center"
          >
            <template slot-scope="scope">
              <span>业绩金额:{{ scope.row.platformhighlevelstandards }}</span>
              <br />
              <span
                >邀请合伙人数:{{ scope.row.platformhighstandardsnumber }}</span
              >
            </template>
          </el-table-column>
          <el-table-column
            label="平台普通合伙人达标标准"
            width="200"
            align="center"
          >
            <template slot-scope="scope">
              <span>业绩金额:{{ scope.row.platformcommonlevelstandards }}</span>
              <br />
              <span
                >邀请合伙人数:{{
                  scope.row.platformcommonlstandardsnumber
                }}</span
              >
            </template>
          </el-table-column>
          <el-table-column label="全球高级达标标准" width="200" align="center">
            <template slot-scope="scope">
              <span>业绩金额:{{ scope.row.firsthighlevelstandards }}</span>
              <br />
              <span>邀请合伙人数:{{ scope.row.firsthighstandardsnumber }}</span>
            </template>
          </el-table-column>
          <el-table-column label="全球普通达标标准" width="200" align="center">
            <template slot-scope="scope">
              <span>业绩金额:{{ scope.row.firstcommonllevelstandards }}</span>
              <br />
              <span
                >邀请合伙人数:{{ scope.row.firstcommonlstandardsnumber }}</span
              >
            </template>
          </el-table-column>
          <el-table-column label="省级高级达标标准" width="200" align="center">
            <template slot-scope="scope">
              <span>业绩金额:{{ scope.row.secondhighlevelstandards }}</span>
              <br />
              <span
                >邀请合伙人数:{{ scope.row.secondhighstandardsnumber }}</span
              >
            </template>
          </el-table-column>
          <el-table-column label="省级普通达标标准" width="200" align="center">
            <template slot-scope="scope">
              <span>业绩金额:{{ scope.row.secondcommonlevelstandards }}</span>
              <br />
              <span
                >邀请合伙人数:{{ scope.row.secondcommonstandardsnumber }}</span
              >
            </template>
          </el-table-column>
          <el-table-column label="市级高级达标标准" width="200" align="center">
            <template slot-scope="scope">
              <span>业绩金额:{{ scope.row.threehighlevelstandards }}</span>
              <br />
              <span>邀请合伙人数:{{ scope.row.threehighstandardsnumber }}</span>
            </template>
          </el-table-column>
          <el-table-column label="市级普通达标标准" width="200" align="center">
            <template slot-scope="scope">
              <span>业绩金额:{{ scope.row.threecommonlevelstandards }}</span>
              <br />
              <span
                >邀请合伙人数:{{ scope.row.threecommonstandardsnumber }}</span
              >
            </template>
          </el-table-column>
          <el-table-column label="县级高级达标标准" width="200" align="center">
            <template slot-scope="scope">
              <span>业绩金额:{{ scope.row.fourhighlevelstandards }}</span>
              <br />
              <span>邀请合伙人数:{{ scope.row.fourhighstandardsnumber }}</span>
            </template>
          </el-table-column>
          <el-table-column label="县级普通达标标准" width="200" align="center">
            <template slot-scope="scope">
              <span>业绩金额:{{ scope.row.fourcommonlevelstandards }}</span>
              <br />
              <span
                >邀请合伙人数:{{ scope.row.fourcommonstandardsnumber }}</span
              >
            </template>
          </el-table-column>
          <el-table-column
            label="共享商城业绩达标标准"
            width="200"
            align="center"
          >
            <template slot-scope="scope">
              <span>业绩金额:{{ scope.row.cooperativeentitystandards }}</span>
            </template>
          </el-table-column>
          <el-table-column
            label="代理商品业绩达标标准"
            width="200"
            align="center"
          >
            <template slot-scope="scope">
              <span
                >业绩金额:{{ scope.row.commodityperformancestandards }}</span
              >
            </template>
          </el-table-column>

          <el-table-column
            label="操作"
            width="210"
            fixed="right"
            align="center"
          >
            <template slot-scope="scope">
              <el-button
                type="primary"
                size="mini"
                @click.native="detailForm(scope.$index, scope.row)"
                >编辑</el-button
              >
            </template>
          </el-table-column>
        </el-table>
        <!--列表end --222e-->
        <br />
      </div>

      <!--新增/编辑弹框start--333s-->
      <el-dialog
        :title="dialogAddOrEditName"
        :visible.sync="dialogAddOrEdit"
        top="5vh"
        width="50%"
        :before-close="hideDialogAddOrEdit"
        :close-on-click-modal="false"
        v-dialogDrag
      >
        <template slot="title">
          <div class="avue-crud__dialog__header">
            <span class="el-dialog__title">
              <span
                style="
                  display: inline-block;
                  background-color: #3478f5;
                  width: 3px;
                  height: 20px;
                  margin-right: 5px;
                  float: left;
                  margin-top: 2px;
                "
              ></span>
              {{ dialogAddOrEditName }}
            </span>
            <div class="avue-crud__dialog__menu">
              <icon-svg icon-class="quanping" />
              <span class="mention">双击全屏</span>
            </div>
          </div>
        </template>
        <el-card>
          <el-form
            :model="formData"
            :rules="rules"
            ref="ruleForm"
            class="demo-ruleForm"
            label-width="400px"
          >
            <!-- 全球品牌合伙公司业绩达标金额（高级） -->
            <!-- 全球品牌合伙公司业绩达标金额（普通） -->
            <!-- 省级品牌合伙公司业绩达标金额（高级） -->
            <!-- 省级品牌合伙公司业绩达标金额（普通） -->
            <!-- 市级品牌合伙公司业绩达标金额（高级） -->
            <!-- 市级品牌合伙公司业绩达标金额（普通） -->
            <!-- 县级品牌合伙公司业绩达标金额（高级） -->

            <el-form-item
              label="平台合伙人（高级）业绩达标金额："
              prop="platformhighlevelstandards"
            >
              <el-input
                v-model="formData.platformhighlevelstandards"
                placeholder="请输入平台合伙人（高级）业绩达标金额"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>
            <el-form-item
              label="平台合伙人（高级）邀请合伙达标人数："
              prop="platformhighstandardsnumber"
            >
              <el-input
                v-model="formData.platformhighstandardsnumber"
                placeholder="请输入平台合伙人（高级）邀请合伙达标人数"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>
            <el-form-item
              label="平台合伙人（普通）业绩达标金额："
              prop="platformcommonlevelstandards"
            >
              <el-input
                v-model="formData.platformcommonlevelstandards"
                placeholder="请输入平台合伙人（普通）业绩达标金额"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>
            <el-form-item
              label="平台合伙人（普通）邀请合伙达标人数："
              prop="platformcommonlstandardsnumber"
            >
              <el-input
                v-model="formData.platformcommonlstandardsnumber"
                placeholder="请输入平台合伙人（普通）邀请合伙达标人数"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>

            <el-form-item
              label="全球品牌合伙公司业绩达标金额（高级）："
              prop="firsthighlevelstandards"
            >
              <el-input
                v-model="formData.firsthighlevelstandards"
                placeholder="请输入全球品牌合伙公司业绩达标金额（高级）"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>
            <el-form-item
              label="全球品牌合伙公司邀请合伙达标人数（高级）："
              prop="firsthighstandardsnumber"
            >
              <el-input
                v-model="formData.firsthighstandardsnumber"
                placeholder="请输入全球品牌合伙公司邀请合伙达标人数（高级）"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>
            <el-form-item
              label="全球品牌合伙公司业绩达标金额（普通）："
              prop="firstcommonllevelstandards"
            >
              <el-input
                v-model="formData.firstcommonllevelstandards"
                placeholder="请输入全球品牌合伙公司业绩达标金额（普通）"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>
            <el-form-item
              label="全球品牌合伙公司邀请合伙达标人数（普通）："
              prop="firstcommonlstandardsnumber"
            >
              <el-input
                v-model="formData.firstcommonlstandardsnumber"
                placeholder="请输入全球品牌合伙公司邀请合伙达标人数（普通）"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>

            <el-form-item
              label="省级品牌合伙公司业绩达标金额（高级）："
              prop="secondhighlevelstandards"
            >
              <el-input
                v-model="formData.secondhighlevelstandards"
                placeholder="请输入省级品牌合伙公司业绩达标金额（高级）"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>
            <el-form-item
              label="省级品牌合伙公司邀请合伙达标人数（高级）："
              prop="secondhighstandardsnumber"
            >
              <el-input
                v-model="formData.secondhighstandardsnumber"
                placeholder="请输入省级品牌合伙公司邀请合伙达标人数（高级）"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>

            <el-form-item
              label="省级品牌合伙公司业绩达标金额（普通）："
              prop="secondcommonlevelstandards"
            >
              <el-input
                v-model="formData.secondcommonlevelstandards"
                placeholder="请输入省级品牌合伙公司业绩达标金额（普通）"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>
            <el-form-item
              label="省级品牌合伙公司邀请合伙达标人数（普通）："
              prop="secondcommonstandardsnumber"
            >
              <el-input
                v-model="formData.secondcommonstandardsnumber"
                placeholder="请输入省级品牌合伙公司邀请合伙达标人数（普通）"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>

            <el-form-item
              label="市级品牌合伙公司业绩达标金额（高级）："
              prop="threehighlevelstandards"
            >
              <el-input
                v-model="formData.threehighlevelstandards"
                placeholder="请输入市级品牌合伙公司业绩达标金额（高级）"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>
            <el-form-item
              label="市级品牌合伙公司邀请合伙达标人数（高级）："
              prop="threehighstandardsnumber"
            >
              <el-input
                v-model="formData.threehighstandardsnumber"
                placeholder="请输入市级品牌合伙公司邀请合伙达标人数（高级）"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>
            <el-form-item
              label="市级品牌合伙公司业绩达标金额（普通）："
              prop="threecommonlevelstandards"
            >
              <el-input
                v-model="formData.threecommonlevelstandards"
                placeholder="请输入市级品牌合伙公司业绩达标金额（普通）"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>
            <el-form-item
              label="市级品牌合伙公司邀请合伙达标人数（普通）："
              prop="threecommonstandardsnumber"
            >
              <el-input
                v-model="formData.threecommonstandardsnumber"
                placeholder="请输入市级品牌合伙公司邀请合伙达标人数（普通）"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>

            <el-form-item
              label="县级品牌合伙公司业绩达标金额（高级）："
              prop="fourhighlevelstandards"
            >
              <el-input
                v-model="formData.fourhighlevelstandards"
                placeholder="请输入县级品牌合伙公司业绩达标金额（高级）"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>
            <el-form-item
              label="县级品牌合伙公司邀请合伙达标人数（高级）："
              prop="fourhighstandardsnumber"
            >
              <el-input
                v-model="formData.fourhighstandardsnumber"
                placeholder="请输入县级品牌合伙公司邀请合伙达标人数（高级）"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>
            <el-form-item
              label="县级品牌合伙公司业绩达标金额（普通）："
              prop="fourcommonlevelstandards"
            >
              <el-input
                v-model="formData.fourcommonlevelstandards"
                placeholder="请输入县级品牌合伙公司业绩达标金额（普通）"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>
            <el-form-item
              label="县级品牌合伙公司邀请合伙达标人数（普通）："
              prop="fourcommonstandardsnumber"
            >
              <el-input
                v-model="formData.fourcommonstandardsnumber"
                placeholder="请输入县级品牌合伙公司邀请合伙达标人数（普通）"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>

            <el-form-item
              label="共享商城业绩达标金额："
              prop="cooperativeentitystandards"
            >
              <el-input
                v-model="formData.cooperativeentitystandards"
                placeholder="共享商城业绩达标金额"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>
            <el-form-item
              label="代理商品业绩达标金额："
              prop="commodityperformancestandards"
            >
              <el-input
                v-model="formData.commodityperformancestandards"
                placeholder="代理商品业绩达标金额"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>
          </el-form>
        </el-card>
        <div slot="footer" class="dialog-footer">
          <el-button @click="closeCheck">取消</el-button>
          <el-button
            type="primary"
            :loading="formSumbitLoding"
            @click="formSumbit"
            >提交</el-button
          >
        </div>
      </el-dialog>
      <!--公司孵化规则列表start --->
      <!-- <div class="middle">
        <el-form :inline="true" :model="query" class="query-form" size="small">
          <el-form-item label="公司孵化规则："> </el-form-item>
        </el-form>
        <el-table
          ref="multipleTable"
          v-loading="loading"
          :data="configList"
          :header-cell-style="{ background: '#F4F4F5', color: '#606266' }"
          border
        >
          <el-table-column
            label="序号"
            prop="globabrandid"
            width="50"
            align="center"
            fixed
          >
            <template slot-scope="scope">
              <span>{{ scope.$index + 1 }}</span>
            </template>
          </el-table-column>
          <el-table-column label="县级公司孵化达标标准" align="center">
            <template slot-scope="scope">
              <span>散下合伙人数量:{{ scope.row.areatarget }}</span>
            </template>
          </el-table-column>
          <el-table-column label="市级公司孵化达标标准" align="center">
            <template slot-scope="scope">
              <span
                >散下县级公司数量（含审核通过未生效）:{{
                  scope.row.citytarget
                }}</span
              >
            </template>
          </el-table-column>
          <el-table-column label="省级公司孵化达标标准" align="center">
            <template slot-scope="scope">
              
              <span
                >散下县级公司数量（含审核通过未生效）:{{
                  scope.row.provincetarget
                }}</span
              >
            </template>
          </el-table-column>
          <el-table-column label="全球公司孵化达标标准" align="center">
            <template slot-scope="scope">
              <span
                >散下县级公司数量（含审核通过未生效）:{{
                  scope.row.gloaltarget
                }}</span
              >
            </template>
          </el-table-column>

          <el-table-column
            label="操作"
            width="210"
            fixed="right"
            align="center"
          >
            <template slot-scope="scope">
              <el-button
                type="primary"
                size="mini"
                @click.native="editForm(scope.$index, scope.row)"
                >编辑</el-button
              >
            </template>
          </el-table-column>
        </el-table>
      </div>

      <el-dialog
        title="编辑"
        :visible.sync="editdialogForm"
        top="5vh"
        width="50%"
        :close-on-click-modal="false"
      >
        <template slot="title">
          <div class="avue-crud__dialog__header">
            <span class="el-dialog__title">
              <span
                style="
                  display: inline-block;
                  background-color: #3478f5;
                  width: 3px;
                  height: 20px;
                  margin-right: 5px;
                  float: left;
                  margin-top: 2px;
                "
              ></span>
              编辑
            </span>
          </div>
        </template>
        <el-card>
          <el-form
            :model="configData"
            :rules="configDatarules"
            class="demo-ruleForm"
            ref="configData"
            label-width="450px"
          >
            <el-form-item
              label="县级公司孵化达标标准：（散下合伙人数量）"
              prop="areatarget"
            >
              <el-input
                type="number"
                v-model="configData.areatarget"
                placeholder="请输入县级公司孵化达标标准：（散下合伙人数量）"
                min="1"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>
            <el-form-item
              label="市级公司孵化达标标准：散下县级公司数量（含审核通过未生效）"
              prop="citytarget"
            >
              <el-input
                type="number"
                v-model="configData.citytarget"
                placeholder="市级公司孵化达标标准：散下县级公司数量（含审核通过未生效）"
                min="1"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>
            <el-form-item
              label="省级公司孵化达标标准：散下县级公司数量（含审核通过未生效）"
              min="1"
              prop="provincetarget"
            >
              <el-input
                type="number"
                v-model="configData.provincetarget"
                min="1"
                placeholder="请输入省级公司孵化达标标准：散下县级公司数量（含审核通过未生效）"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>

            <el-form-item
              label="全球公司孵化达标标准：散下县级公司数量（含审核通过未生效）"
              min="1"
              prop="gloaltarget"
            >
              <el-input
                type="number"
                v-model="configData.gloaltarget"
                placeholder="请输入全球公司孵化达标标准：散下县级公司数量（含审核通过未生效）"
                @keyup.enter.native="onSubmit"
                clearable
              ></el-input>
            </el-form-item>
          </el-form>
        </el-card>
        <div slot="footer" class="dialog-footer">
          <el-button @click="closeCheck">取消</el-button>
          <el-button
            type="primary"
            :loading="formSumbitLoding"
            @click="configSumbit"
            >提交</el-button
          >
        </div>
      </el-dialog> -->
    </el-card>
  </div>
</template>
<script>
import {
  getCompanyDeployList, // 查询品牌合伙公司升级配置
  addOrUpdateBrandNew, // 添加/修改品牌合伙公司升级配置
} from "../../api/partnershipManagement/partnershipManagement.js";
// 获取公司孵化的数据列表和存储修改的信息
// import {
//   getIncubateCompanyConfig,
//   saveIncubateCompanyConfig,
// } from '../../api/companyLevel'
/*用作表单的数据初始化*/
import { BASE_URL } from "../../config/app";
const formJson = {
  platformhighlevelstandards: null,
  platformhighstandardsnumber: null,
  platformcommonlevelstandards: null,
  platformcommonlstandardsnumber: null,
  firsthighlevelstandards: null,
  firstcommonllevelstandards: null,
  secondhighlevelstandards: null,
  secondcommonlevelstandards: null,
  threehighlevelstandards: null,
  threecommonlevelstandards: null,
  fourhighlevelstandards: null,
  fourcommonlevelstandards: null,
  // ^[1-9]\d*$
  firsthighstandardsnumber: null, // '全球品牌合伙公司（高级）邀请合伙达标人数',
  firstcommonlstandardsnumber: null, // '全球品牌合伙公司（普通）邀请合伙达标人数',
  secondhighstandardsnumber: null, // '省级品牌合伙公司（高级）邀请合伙达标人数',
  secondcommonstandardsnumber: null, // '省级品牌合伙公司（普通）邀请合伙达标人数',
  threehighstandardsnumber: null, // '市级品牌合伙公司（高级）邀请合伙达标人数',
  threecommonstandardsnumber: null, //'市级品牌合伙公司（普通）邀请合伙达标人数',
  fourhighstandardsnumber: null, // '县级品牌合伙公司（高级）邀请合伙达标人数',
  fourcommonstandardsnumber: null, // '县级品牌合伙公司（普通）邀请合伙达标人数',
  cooperativeentitystandards: null,
  commodityperformancestandards: null,
};

export default {
  components: {},
  data() {
    // var checknumber = (rule, value, callback) => {
    //     const numberReg = /^[1-9]\d*$/
    //     // if (!value) {
    //     //     return callback(new Error('数值不能为空'))
    //     // }
    //     // setTimeout(() => {
    //     //     if (numberReg.test(value)) {
    //     //         callback()
    //     //     } else {
    //     //         callback(new Error('请输入大于0的正整数'))
    //     //     }
    //     // }, 100)
    // };

    return {
      uploadUrl: BASE_URL + "/goldendays-currency/tool/uploadpro", //上传图片
      uploadData: [],
      query: {
        currentPage: 1,
        searchtext: "",
        pageSize: 10,
      },
      checkQuery: {
        currentPage: 1,
        pageSize: 10,
      },
      commodityIdArr: [],
      checkTotalNumber: 0, //分页总页数
      formName: null,
      merchantslist: [],
      merchantsgoodslist: [],
      list: [], //合伙人晋升规则列表集合
      configList: [], //合伙人孵化规则列表集合
      configData: {}, //合伙人孵化公司obj回显
      totalNumber: 0, //分页总页数
      loading: true, //列表加载
      checkLoading: false,
      formSumbitLoding: false, //表单提交加载
      cancelToggle: false, //列表是否全选
      multipleSelection: [], //多选集合
      dialogAddOrEdit: false, //新增或编辑弹框开关
      dialogAddOrEditName: "", //新增或编辑弹框名字
      formData: formJson, //新增或修改的对象
      editdialogForm: false, //孵化公司编辑框
      configDatarules: {
        //编辑表单校验
        areatarget: {
          required: true,
          message: "请输入县级公司孵化达标标准：（散下合伙人数量）",
          trigger: "blur",
        },
        citytarget: {
          required: true,
          message:
            "请输入市级公司孵化达标标准：散下县级公司数量（含审核通过未生效）",
          trigger: "blur",
        },
        provincetarget: {
          required: true,
          message:
            "请输入省级公司孵化达标标准：散下县级公司数量（含审核通过未生效）",
          trigger: "blur",
        },
        gloaltarget: {
          required: true,
          message:
            "请输入全球公司孵化达标标准：散下县级公司数量（含审核通过未生效）",
          trigger: "blur",
        },
      },
      rules: {
        //表单校验
        platformhighlevelstandards: {
          required: true,
          message: "请输入平台合伙人(高级)业绩达标金额",
          trigger: "blur",
        },
        platformhighstandardsnumber: {
          required: true,
          message: "请输入平台合伙人(高级)邀请合伙达标人数",
          trigger: "blur",
        },
        platformcommonlevelstandards: {
          required: true,
          message: "请输入平台合伙人(普通)业绩达标金额",
          trigger: "blur",
        },
        platformcommonlstandardsnumber: {
          required: true,
          message: "请输入平台合伙人(普通)邀请合伙达标人数",
          trigger: "blur",
        },
        firsthighlevelstandards: {
          required: true,
          message: "请输入全球品牌合伙公司业绩达标金额（高级）",
          trigger: "blur",
        },
        firstcommonllevelstandards: {
          required: true,
          message: "请输入全球品牌合伙公司业绩达标金额（普通）",
          trigger: "blur",
        },
        secondhighlevelstandards: {
          required: true,
          message: "请输入省级品牌合伙公司业绩达标金额（高级）",
          trigger: "blur",
        },
        secondcommonlevelstandards: {
          required: true,
          message: "请输入省级品牌合伙公司业绩达标金额（普通）",
          trigger: "blur",
        },
        threehighlevelstandards: {
          required: true,
          message: "请输入市级品牌合伙公司业绩达标金额（高级）",
          trigger: "blur",
        },
        threecommonlevelstandards: {
          required: true,
          message: "请输入市级品牌合伙公司业绩达标金额（普通）",
          trigger: "blur",
        },
        fourhighlevelstandards: {
          required: true,
          message: "请输入县级品牌合伙公司业绩达标金额（高级）",
          trigger: "blur",
        },
        fourcommonlevelstandards: {
          required: true,
          message: "请输入县级品牌合伙公司业绩达标金额（普通）",
          trigger: "blur",
        },
        firsthighstandardsnumber: {
          required: true,
          message: "请输入全球品牌合伙公司邀请合伙达标人数（高级）",
          trigger: "blur",
        },
        firstcommonlstandardsnumber: {
          required: true,
          message: "请输入全球品牌合伙公司邀请合伙达标人数（普通）",
          trigger: "blur",
        },
        secondhighstandardsnumber: {
          required: true,
          message: "请输入省级品牌合伙公司邀请合伙达标人数（高级）",
          trigger: "blur",
        },
        secondcommonstandardsnumber: {
          required: true,
          message: "请输入省级品牌合伙公司邀请合伙达标人数（普通）",
          trigger: "blur",
        },
        threehighstandardsnumber: {
          required: true,
          message: "请输入市级品牌合伙公司邀请合伙达标人数（高级）",
          trigger: "blur",
        },
        threecommonstandardsnumber: {
          required: true,
          message: "请输入市级品牌合伙公司邀请合伙达标人数（普通）",
          trigger: "blur",
        },
        fourhighstandardsnumber: {
          required: true,
          message: "请输入县级品牌合伙公司邀请合伙达标人数（高级）",
          trigger: "blur",
        },
        fourcommonstandardsnumber: {
          required: true,
          message: "请输入县级品牌合伙公司邀请合伙达标人数（普通）",
          trigger: "blur",
        },
        cooperativeentitystandards: {
          required: true,
          message: "请输入共享商城业绩达标金额",
          trigger: "blur",
        },
        commodityperformancestandards: {
          required: true,
          message: "请输入代理商品业绩达标金额",
          trigger: "blur",
        },
      },
    };
  },

  methods: {
    /*获取合伙人晋升列表列表事件*/
    getGlobalBrandList() {
      this.loading = true;
      //   getTopList
      getCompanyDeployList()
        .then((response) => {
          if (response.code != 0) {
            this.$message.error(response.message);
            this.loading = false;
            return false;
          }
          // console.log(response);
          this.list = response.data || [];
          // this.totalNumber = response.data.totalNumber || 0;
          setTimeout(() => {
            this.loading = false;
          }, 0.3 * 1000);
        })
        .catch(() => {
          this.loading = false;
          this.list = [];
        });
    },
    //获取公司孵化规则列表事件
    // getIncubateCompanyConfig() {
    //   this.loading = true
    //   getIncubateCompanyConfig()
    //     .then((data) => {
    //       if (data.code != 0) {
    //         this.$message.error(data.message)
    //         this.loading = false
    //         return false
    //       }
    //       console.log(data)
    //       this.configList = data.data.list || []
    //       setTimeout(() => {
    //         this.loading = false
    //       }, 0.3 * 1000)
    //     })
    //     .catch(() => {
    //       this.loading = false
    //       this.configList = []
    //     })
    // },

    /*新增或者编辑提交事件*/
    formSumbit() {
      //表单校验通过
      this.$refs["ruleForm"].validate((valid) => {
        // console.log(valid)
        if (valid) {
          console.log(this.formData);
          this.formSumbitLoding = true;
          addOrUpdateBrandNew(this.formData)
            .then((response) => {
              this.formSumbitLoding = false;
              if (response.code != 0) {
                this.$message.error(response.message);
                return false;
              }
              this.$message.success("操作成功");
              this.dialogAddOrEdit = false;
              // 加载表格数据
              this.getGlobalBrandList();
            })
            .catch(() => {
              this.formSumbitLoding = false;
            });
        }
      });
      //new URLSearchParams(this.query)  提交数据格式不正确时可以转一下
    },

    closeCheck() {
      this.editdialogForm = false;
      this.dialogAddOrEdit = false;
      this.merchantsgoodslist = [];
      this.checkTotalNumber = 0;
      this.$refs['ruleForm'].clearValidate();
    },
    /*列表查询条件事件*/
    onSubmit() {
      this.query.currentPage = 1;
      this.getGlobalBrandList();
    },

    /*刷新*/
    onRest() {
      //刷新事件需要重置查询条件
      this.query = {
        currentPage: 1,
        pageSize: 10,
      };
      this.getGlobalBrandList();
    },

    //显示 查看弹框
    detailForm(index, row) {
      this.dialogAddOrEditName = "编辑";
      if (row !== null) {
        console.info(row);
        this.dialogAddOrEdit = true;
        this.formData = Object.assign({}, row);
        let data = {
          name: "",
          url: "",
        };
        if (row.topcategorypic) {
          this.uploadData = [];
          let nameurl = row.topcategorypic;
          data.url = nameurl;
          data.name = nameurl.substring(nameurl.lastIndexOf("/") + 1);
          this.uploadData.push(data);
        }
      }
    },
    //公司孵化编辑按钮
    editForm(i, val) {
      console.log(i), console.log(val);
      this.editdialogForm = true;
      this.configData = val;
    },
    //编辑完成后要进行提交
    // configSumbit() {
    //   //表单校验通过
    //   this.$refs['configData'].validate((valid) => {
    //     console.log(valid)
    //     if (valid) {
    //       // console.log(this.configData);
    //       this.formSumbitLoding = true
    //       let data = {
    //         areatarget: +this.configData.areatarget,
    //         citytarget: +this.configData.citytarget,
    //         provincetarget: +this.configData.provincetarget,
    //         gloaltarget: +this.configData.gloaltarget,
    //         incubateid: +this.configData.incubateid,
    //       }
    //       console.log(data)
    //       saveIncubateCompanyConfig(data)
    //         .then((response) => {
    //           this.formSumbitLoding = false
    //           if (response.code != 0) {
    //             this.$message.error(response.message)
    //             return false
    //           }
    //           this.$message.success('操作成功')
    //           this.editdialogForm = false
    //           // 加载表格数据
    //           // this.getIncubateCompanyConfig()
    //         })
    //         .catch(() => {
    //           this.formSumbitLoding = false
    //         })
    //     }
    //   })
    // },

    /*显示 -新增或者编辑弹框*/
    showDialogAddOrEdit() {
      this.formData = Object.assign({}, formJson);
      this.dialogAddOrEdit = true;
      this.dialogAddOrEditName = "添加";
    },

    /*隐藏 -新增或编辑弹框*/
    hideDialogAddOrEdit() {
      this.dialogAddOrEdit = false;
      this.merchantsgoodslist = [];
      //隐藏弹框时需要清除弹框内容
      if (this.$refs["ruleForm"]) {
        this.$refs["ruleForm"].resetFields(); //清除formData表单
        // this.$refs["ruleForm"].clearValidate(); //清除表单验证
      }
      //如果上传文件，还需要清除文件列表
    },

    /*点击页数*/
    handleCurrentChange(val) {
      this.query.currentPage = val;
      this.getGlobalBrandList();
    },

    /*选择每页条数【10,20,30,40,50】*/
    handleSizeChange(val) {
      this.query.pageSize = val;
      this.getGlobalBrandList();
    },
    /*弹窗 选择每页条数【10,20,30,40,50】*/
    checkHandleSizeChange(val) {
      this.checkQuery.pageSize = val;
    },
    /*弹窗 点击页数*/
    checkHandleCurrentChange(val) {
      this.checkQuery.currentPage = val;
    },
    /*弹窗 列表复选框选择事件*/
    checkHandleSelectionChange(val) {
      console.log(val);
      let arr = [];
      val.forEach((value, index) => {
        console.log(index);
        arr.push(value.commodityid);
      });
      this.commodityIdArr = arr;
    },
  },
  created() {
    this.getGlobalBrandList();
    // this.getIncubateCompanyConfig()
  },
};
</script>
<style lang="scss"  scoped>
.el-dialog {
  position: relative;
  margin: 0 auto 0px;
  background: #ffffff;
  border-radius: 2px;
  -webkit-box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
  width: 50%;
  height: 85%;
}
.el-dialog__body {
  border-top: 1px solid #dcdfe6;
  border-bottom: 1px solid #dcdfe6;
  max-height: 85% !important;
  min-height: 70%;
  overflow-y: visible;
}
.top {
  margin-bottom: 30px;
}
</style>
